package com.rois.sample.CompReaction;

import com.rois.librois.RoIS.ReturnCode_t;

public class ExecuteOperationImpl implements ExecuteOperation{
	private Window window = null;
	public void setWindow(Window window_obj)
	{
		window = window_obj;
	}

	@Override
	public ReturnCode_t start(
		String filename,
		String command_id
	)
	{
		ReturnCode_t roRes = ReturnCode_t.RoIS_OK;
		if(window!=null)
		{
			window.setImage( command_id, filename+".png" );
		}
		return roRes;
	}

	@Override
	public ReturnCode_t stop(
		String command_id
	)
	{
		ReturnCode_t roRes = ReturnCode_t.RoIS_OK;
		if(window!=null)
		{
			window.setDefaultImage(command_id);
		}
		return roRes;
	}

	@Override
	public ReturnCode_t suspend(
		String command_id
	)
	{
		ReturnCode_t roRes = ReturnCode_t.RoIS_OK;
		//@@ FOR DUMMY: set current message to suspend
		if(window!=null)
		{
			window.setCurrentImage(command_id);
		}
		return roRes;
	}

	@Override
	public ReturnCode_t resume(
		String command_id
	)
	{
		ReturnCode_t roRes = ReturnCode_t.RoIS_OK;
		//@@ FOR DUMMY: set current message to resume
		if(window!=null)
		{
			window.setCurrentImage(command_id);
		}
		return roRes;
	}

	@Override
	public ReturnCode_t set_parameter(
		String command_id
	)
	{
		ReturnCode_t roRes = ReturnCode_t.RoIS_OK;
		//@@ FOR DUMMY: set current message to set parameter(set new image when called "start")
		if(window!=null)
		{
			window.setCurrentImage(command_id);
		}
		return roRes;
	}

}
